from sqlalchemy.orm import Session
from typing import Optional, List
from app.models.iaro_career.ite_supervisor import ITESupervisor
from app.schema.supervisor_schema import ITESupervisorCreate, ITESupervisorUpdate

def get_supervisors_by_ite(db: Session, ite_id: int) -> List[ITESupervisor]:
    return db.query(ITESupervisor).filter(ITESupervisor.ite_id == ite_id).all()

def create_supervisor(db: Session, data: ITESupervisorCreate) -> ITESupervisor:
    supervisor = ITESupervisor(**data.dict())
    db.add(supervisor)
    db.commit()
    db.refresh(supervisor)
    return supervisor
